In this vignette, you will find out about pre-set visualisations in AHgen:

  • Section 1 - Visualising the Abstraction Hierarchy
  • Section 2 - Visualising and exploring results

To navigate to other vignettes, go to Vignette 0 - Welcome to AHgen.

1. Visualising the Abstraction Hierarchy

This section will cover pre-set visualisations for the Abstraction Hierarchy itself.

First we need to create a key to specify the positioning of vertices, in AHgen called a visKey. This could also be done in a .xlsx file externally and imported into R.

visKey =
  tribble(
    ~layer, ~min, ~max, ~addR, ~r,
    1,250,290,0,1,
    2,250,290,0,2,
    3,260,280,0,3,
    4,260,280,0,4,
    5,250,290,0,5)

visKey
## # A tibble: 5 × 5
##   layer   min   max  addR     r
##   <dbl> <dbl> <dbl> <dbl> <dbl>
## 1     1   250   290     0     1
## 2     2   250   290     0     2
## 3     3   260   280     0     3
## 4     4   260   280     0     4
## 5     5   250   290     0     5

The vis_AH_layout() function generates a layout for visualising an Abstraction Hierarchy i.e. five-level hierarchical network.

It has five input arguments:

  • edgelist - the edge list of the network to be visualised
  • vInfo - the vertex information
  • minSpacing - the minimum spacing between nodes; by default this is set to minSpacing = 0
  • maxSpacing - the maximum spacing between nodes; by default this is set to maxSpacing = 100
  • key - the key to specify the visualisation layout
plot_layout = 
  vis_AH_layout(edgelist = de,
                vInfo = dv,
                minSpacing = 0, 
                maxSpacing = 1000,
                key = visKey)

plot_layout
## $edges
## # A tibble: 20 × 9
##    from.level to.level layer      from     to            x     y      xend  yend
##         <dbl>    <dbl> <chr>      <chr>    <chr>     <dbl> <dbl>     <dbl> <dbl>
##  1          1        2 l1FP_l2VPM Provide… Incr… -1.84e-16 -1    -6.84e- 1 -1.88
##  2          1        2 l1FP_l2VPM Provide… Road… -1.84e-16 -1    -3.67e-16 -2   
##  3          2        2 l2VPM_l3GF Increas… Comp… -6.84e- 1 -1.88  6.84e- 1 -1.88
##  4          2        3 l2VPM_l3GF Increas… Effe… -6.84e- 1 -1.88 -5.21e- 1 -2.95
##  5          2        3 l2VPM_l3GF Increas… Safe… -6.84e- 1 -1.88 -5.51e-16 -3   
##  6          2        2 l2VPM_l3GF Road us… Comp… -3.67e-16 -2     6.84e- 1 -1.88
##  7          2        3 l2VPM_l3GF Road us… Effe… -3.67e-16 -2    -5.21e- 1 -2.95
##  8          2        3 l2VPM_l3GF Road us… Safe… -3.67e-16 -2    -5.51e-16 -3   
##  9          2        3 l3GF_l4ORP Complia… Driv…  6.84e- 1 -1.88  5.21e- 1 -2.95
## 10          2        4 l3GF_l4ORP Complia… Road…  6.84e- 1 -1.88 -6.95e- 1 -3.94
## 11          2        4 l3GF_l4ORP Complia… Vehi…  6.84e- 1 -1.88  6.95e- 1 -3.94
## 12          3        3 l3GF_l4ORP Effecti… Driv… -5.21e- 1 -2.95  5.21e- 1 -2.95
## 13          3        4 l3GF_l4ORP Effecti… Road… -5.21e- 1 -2.95 -6.95e- 1 -3.94
## 14          3        4 l3GF_l4ORP Effecti… Vehi… -5.21e- 1 -2.95  6.95e- 1 -3.94
## 15          3        3 l3GF_l4ORP Safe ef… Driv… -5.51e-16 -3     5.21e- 1 -2.95
## 16          3        4 l3GF_l4ORP Safe ef… Road… -5.51e-16 -3    -6.95e- 1 -3.94
## 17          3        4 l3GF_l4ORP Safe ef… Vehi… -5.51e-16 -3     6.95e- 1 -3.94
## 18          3        5 l4ORP_l5PO Driver … Vehi…  5.21e- 1 -2.95 -9.18e-16 -5   
## 19          4        5 l4ORP_l5PO Road Tr… Vehi… -6.95e- 1 -3.94 -9.18e-16 -5   
## 20          4        5 l4ORP_l5PO Vehicle… Vehi…  6.95e- 1 -3.94 -9.18e-16 -5   
## 
## $vertices
## # A tibble: 10 × 6
##    level Node                                                x     y   pos theta
##    <dbl> <chr>                                           <dbl> <dbl> <int> <dbl>
##  1     1 Provide efficient and accessible mobility   -1.84e-16 -1        1  4.71
##  2     2 Increased road user safety                  -6.84e- 1 -1.88     1  4.36
##  3     2 Road user satisfaction                      -3.67e-16 -2        2  4.71
##  4     2 Compliant user behaviour                     6.84e- 1 -1.88     3  5.06
##  5     3 Effective occupant protection               -5.21e- 1 -2.95     1  4.54
##  6     3 Safe efficient traffic flow                 -5.51e-16 -3        2  4.71
##  7     3 Driver capabilities and limitations          5.21e- 1 -2.95     3  4.89
##  8     4 Road Transportation System capabilities an… -6.95e- 1 -3.94     1  4.54
##  9     4 Vehicle capacity                             6.95e- 1 -3.94     2  4.89
## 10     5 Vehicle components                          -9.18e-16 -5        1  4.71

The function vis_AH_ggplot() generates a standard ggplot.

It has input arguments:

  • layout - a layout generated by vis_AH_layout()
  • key - the key to specify the visualisation layout; by default this is set to key = NULL
  • vecOpacity - a vector of four numeric values representing the opacity of edges in each layer; by default this is set to vecOpacity = c(1, 1, 1, 1)
  • vecSize - a vector of five numeric values representing the size of vertices in each level; by default this is set to vecSize = c(5, 4, 3.5, 3, 2.5)
plot_ggplot = 
  vis_AH_ggplot(layout = plot_layout, 
                key = visKey)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the AHgen package.
##   Please report the issue to the authors.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
plot_ggplot

Lastly is the function vis_AH_plotly(). Functions from the package plotly are used within vis_AH_plotly() to enable the visualisation to be interactive.

It has four input arguments:

  • ggplotPlot - the plot generated with vis_AH_ggplot()
  • layerNames - a vector of four character strings to be used as identifiers for Abstraction Hierarchy layers; by default this is set to layerNames = c("Layer 1-2 - Purposes-Outcomes", "Layer 2-3 - Outcomes-Tasks", "Layer 3-4 - Tasks-Processes", "Layer 4-5 - Processes-Resources")
  • levelNames - a vector of five character strings to be used as identifiers for Abstraction Hierarchy levels; by default this is set to levelNames = c("Level 1 - Purposes", "Level 2 - Outcomes", "Level 3 - Tasks", "Level 4 - Processes", "Level 5 - Resources")
  • circles - whether the visualisation should be circular; by default this is set to circles = TRUE
plot_plotly = 
  vis_AH_plotly(ggplotPlot = plot_ggplot)

plot_plotly

Using the building blocks above, it is possible to create an interactive version of an Abstraction Hierarchy. Below you can explore the AHexploreR, an application of this for a generic UK city (the Urban Systems Abstraction Hierarchy, or USAH).

You can find all underlying code for the AHexploreR, to adapt for your own interactive Abstraction Hierarchy, on GitHub here.

2. Visualising the results

This section covers pre-set output styles to visualise and explore the results of network analysis on Abstraction Hierarchies.

2.1. Plots

AHgen plot styles are bespoke and provided as examples. They have been created thus far during the analysis of Urban Systems Abstraction Hierarchies, and can be adapted for your own purposes.

In the below plots, we use a few custom aesthetics, i.e. specific fonts and colours. Harding is a font family which loosely matches Nature journals. You can search online for and download a .ttf file for your chosen font, and load it in R using the showtext package.

font_add(family = "Harding", regular = "inputs/HardingText-Regular-Web.ttf")
showtext_auto()

Colours can be loaded directly from AHgen, e.g. example data colsFloodRiver_df or colsFloodRiver. Or you can use your own custom colours!

# Cutsom colours for distinguishing between Abstraction Hierarchy levels
colsLevels_df
## # A tibble: 5 × 4
##   level levelName_full               levelName cols   
##   <dbl> <fct>                        <fct>     <chr>  
## 1     1 Functional purposes          Purposes  #CCB1B9
## 2     2 Values and priority measures Outcomes  #607EBC
## 3     3 Generalised functions        Tasks     #77B7A6
## 4     4 Object-related processes     Processes #64324D
## 5     5 Physical objects             Resources #413D4C
colsPurposes
##  Purposes 
## "#CCB1B9"
colsOutcomes
##  Outcomes 
## "#607EBC"
colsTasks
##     Tasks 
## "#77B7A6"
colsProcesses
## Processes 
## "#64324D"
colsResources
## Resources 
## "#413D4C"
# Custom colours for comparing 1 in 100-year and 1 in 200-year floods to a baseline Urban Systems Abstraction Hierarchy
colsFloodRiver_df
## # A tibble: 3 × 2
##   scenario            cols   
##   <fct>               <fct>  
## 1 baseline            #85929E
## 2 1 in 100-year flood #56B4E9
## 3 1 in 200-year flood #0072B2
colsBaseline
## [1] #85929E
## Levels: #85929E #56B4E9 #0072B2
colsFloodRiver
## [1] #85929E #56B4E9 #0072B2
## Levels: #85929E #56B4E9 #0072B2
colsFloodRiver100
## [1] #56B4E9
## Levels: #85929E #56B4E9 #0072B2
colsFloodRiver200
## [1] #0072B2
## Levels: #85929E #56B4E9 #0072B2
# Custom colours for distinguishing between different categories of Outcomes and Tasks in the Urban Systems Abstraction Hierarchy
cols100RC_df
## # A tibble: 51 × 9
##    level levelName_full   levelName Node  cols  health_wellbeing economy_society
##    <dbl> <fct>            <fct>     <chr> <chr> <chr>            <chr>          
##  1     2 Values and prio… Outcomes  Coll… #FA6… FALSE            TRUE           
##  2     2 Values and prio… Outcomes  Comp… #F41… FALSE            TRUE           
##  3     2 Values and prio… Outcomes  Dive… #D24… TRUE             FALSE          
##  4     2 Values and prio… Outcomes  Effe… #238… FALSE            FALSE          
##  5     2 Values and prio… Outcomes  Effe… #296… FALSE            FALSE          
##  6     2 Values and prio… Outcomes  Effe… #A83… TRUE             FALSE          
##  7     2 Values and prio… Outcomes  Empo… #236… FALSE            FALSE          
##  8     2 Values and prio… Outcomes  Envi… #434… FALSE            FALSE          
##  9     2 Values and prio… Outcomes  Inte… #244… FALSE            FALSE          
## 10     2 Values and prio… Outcomes  Mini… #7F2… TRUE             FALSE          
## # ℹ 41 more rows
## # ℹ 2 more variables: infrastructure_ecosystems <chr>,
## #   leadership_strategy <chr>
colsOutcomes_100RC
##     Collective identity and community support 
##                                     "#FA638C" 
##        Comprehensive security and rule of law 
##                                     "#F41570" 
##            Diverse livelihoods and employment 
##                                     "#D2411D" 
##           Effective leadership and management 
##                                     "#238B45" 
##      Effective provision of critical services 
##                                     "#2968AF" 
## Effective safeguards to human health and life 
##                                     "#A83410" 
##                        Empowered stakeholders 
##                                     "#23693A" 
##                  Environmental sustainability 
##                                     "#434DA0" 
##           Integrated development and planning 
##                                     "#24472F" 
##                         Minimal vulnerability 
##                                     "#7F2704" 
##                Reduced exposure and fragility 
##                                     "#66298B" 
##          Reliable communications and mobility 
##                                     "#810F7C" 
##            Socio-economic equality and equity 
##                                     "#DE1F80" 
##                           Sustainable economy 
##                                     "#B01150"
colsOutcomes_ES
## Collective identity and community support 
##                                 "#FA638C" 
##    Comprehensive security and rule of law 
##                                 "#F41570" 
##        Socio-economic equality and equity 
##                                 "#DE1F80" 
##                       Sustainable economy 
##                                 "#B01150"
colsOutcomes_HW
##            Diverse livelihoods and employment 
##                                     "#D2411D" 
## Effective safeguards to human health and life 
##                                     "#A83410" 
##                         Minimal vulnerability 
##                                     "#7F2704"
colsOutcomes_IE
## Effective provision of critical services 
##                                "#2968AF" 
##             Environmental sustainability 
##                                "#434DA0" 
##           Reduced exposure and fragility 
##                                "#66298B" 
##     Reliable communications and mobility 
##                                "#810F7C"
colsOutcomes_LS
## Effective leadership and management              Empowered stakeholders 
##                           "#238B45"                           "#23693A" 
## Integrated development and planning 
##                           "#24472F"
colsTasks_100RC
##                                Animal welfare 
##                                     "#FC6E51" 
##                  Biological hazard regulation 
##                                     "#E74723" 
## Ceremonies and services for major life events 
##                                     "#FB85A5" 
##                                     Clean air 
##                                     "#72A5D0" 
##                                   Clean water 
##                                     "#4487C0" 
##                            Clothing provision 
##                                     "#D2411D" 
##                         Communication systems 
##                                     "#33B864" 
##           Community activities and engagement 
##                                     "#459D62" 
##             Distribution of goods (logistics) 
##                                     "#2968AF" 
##                            Emergency services 
##                                     "#BD3A17" 
##                          Employment provision 
##                                     "#FA638C" 
##                                 Energy supply 
##                                     "#3B56A5" 
##        Environmental and geohazard regulation 
##                                     "#434DA0" 
##                    Environmental conservation 
##                                     "#4C449B" 
##                            Financial services 
##                                     "#F81E59" 
##                                Food provision 
##                                     "#A83410" 
##                        Foster social cohesion 
##                                     "#F41570" 
##                  Goods and services provision 
##                                     "#F1228B" 
##                                    Governance 
##                                     "#238B45" 
##    Historical and cultural value contribution 
##                                     "#DE1F80" 
##                             Housing provision 
##                                     "#932D0A" 
##         Hydrometeorological hazard regulation 
##                                     "#553B95" 
##                                 Law and order 
##                                     "#23793F" 
##                        Learning and education 
##                                     "#23693A" 
##                        Observance of religion 
##                                     "#C71868" 
##                             Physical security 
##                                     "#B01150" 
##                           Planning activities 
##                                     "#245834" 
##                                 Public health 
##                                     "#7F2704" 
##                       Recreational activities 
##                                     "#980043" 
##                    Road conditions and safety 
##                                     "#5E3290" 
##                          Sanitation provision 
##                                     "#66298B" 
##                            Social interaction 
##                                     "#920730" 
##                    Societal hazard regulation 
##                                     "#24472F" 
##               Technological hazard regulation 
##                                     "#6F2086" 
##                                       Tourism 
##                                     "#81021F" 
##                    Travel (people, not goods) 
##                                     "#781781" 
##                              Waste management 
##                                     "#810F7C"
colsTasks_ES
## Ceremonies and services for major life events 
##                                     "#FB85A5" 
##                          Employment provision 
##                                     "#FA638C" 
##                            Financial services 
##                                     "#F81E59" 
##                        Foster social cohesion 
##                                     "#F41570" 
##                  Goods and services provision 
##                                     "#F1228B" 
##    Historical and cultural value contribution 
##                                     "#DE1F80" 
##                        Observance of religion 
##                                     "#C71868" 
##                             Physical security 
##                                     "#B01150" 
##                       Recreational activities 
##                                     "#980043" 
##                            Social interaction 
##                                     "#920730" 
##                                       Tourism 
##                                     "#81021F"
colsTasks_HW
##               Animal welfare Biological hazard regulation 
##                    "#FC6E51"                    "#E74723" 
##           Clothing provision           Emergency services 
##                    "#D2411D"                    "#BD3A17" 
##               Food provision            Housing provision 
##                    "#A83410"                    "#932D0A" 
##                Public health 
##                    "#7F2704"
colsTasks_IE
##                              Clean air                            Clean water 
##                              "#72A5D0"                              "#4487C0" 
##      Distribution of goods (logistics)                          Energy supply 
##                              "#2968AF"                              "#3B56A5" 
## Environmental and geohazard regulation             Environmental conservation 
##                              "#434DA0"                              "#4C449B" 
##  Hydrometeorological hazard regulation             Road conditions and safety 
##                              "#553B95"                              "#5E3290" 
##                   Sanitation provision        Technological hazard regulation 
##                              "#66298B"                              "#6F2086" 
##             Travel (people, not goods)                       Waste management 
##                              "#781781"                              "#810F7C"
colsTasks_LS
##               Communication systems Community activities and engagement 
##                           "#33B864"                           "#459D62" 
##                          Governance                       Law and order 
##                           "#238B45"                           "#23793F" 
##              Learning and education                 Planning activities 
##                           "#23693A"                           "#245834" 
##          Societal hazard regulation 
##                           "#24472F"

Plots from these functions may not display accurately in the Plots window of RStudio, but you can export and inspect them with ggsave() as below.

ggsave(
  filenameTimestamp(prefix = "violinHalf_ECvals", 
                    extension = ".png"),
  plot = violinHalf_ECvals, 
  width = 4, height = 3, dpi = 600)

To adapt the underlying code for your own purposes, inspect any AHgen function with print().

print(vis_plotViolin)
## function (results, metricName, type = "half", levels = NULL, 
##     family = "Harding") 
## {
##     require(ggplot2)
##     require(ggh4x)
##     require(see)
##     require(grid)
##     if (metricName == "EC") {
##         yaxisLab_metric <- "Eigenvector Centrality"
##     }
##     if (metricName == "SBC_norm") {
##         yaxisLab_metric <- "Stable Betweenness Centrality"
##     }
##     yaxisLab <- paste0(yaxisLab_metric, " Value")
##     if (metricName == "EC" & is.null(levels)) {
##         levels <- c("Purposes", "Outcomes", "Tasks")
##     }
##     if (metricName == "SBC_norm" & is.null(levels)) {
##         levels <- c("Tasks", "Processes", "Resources")
##     }
##     results <- results %>% filter(metric == metricName, levelName %in% 
##         levels)
##     if (type == "half") {
##         violinPlot <- ggplot(data = results) + aes(x = levelName, 
##             y = value, fill = scenario) + see::geom_violinhalf(data = results %>% 
##             filter(scenario == "baseline"), alpha = 0.7, aes(fill = colsFloodRiver200), 
##             flip = TRUE, linewidth = 0.1) + see::geom_violinhalf(data = results %>% 
##             filter(scenario == "1 in 100-year flood"), alpha = 0.7, 
##             aes(fill = colsFloodRiver100), linewidth = 0.1) + 
##             see::geom_violinhalf(data = results %>% filter(scenario == 
##                 "1 in 200-year flood"), alpha = 0.7, aes(fill = colsBaseline), 
##                 linewidth = 0.1) + ggh4x::facet_grid2(independent = "x", 
##             levelName ~ location, labeller = label_wrap_gen(width = 15), 
##             scales = "free", switch = "y") + labs(y = yaxisLab) + 
##             scale_fill_manual(name = "scenario", values = levels(results$cols), 
##                 labels = levels(results$scenario)) + scale_y_continuous(limits = c(0, 
##             NA), position = "right") + theme(axis.text.x = element_blank(), 
##             axis.text.y = element_text(color = "grey40", size = 24), 
##             axis.ticks.x = element_blank(), axis.ticks.y = element_line(color = "grey90", 
##                 linewidth = 0.2), axis.title.x = element_blank(), 
##             axis.title.y = element_text(color = "grey40", size = 32), 
##             legend.box.margin = margin(-4, -4, -4, -4), legend.key.size = unit(0.4, 
##                 "line"), legend.justification = "center", legend.margin = margin(c(2, 
##                 0, 4, 0)), legend.position = "bottom", legend.spacing.x = unit(1.4, 
##                 "mm"), legend.text = element_text(color = "grey40", 
##                 size = 32), legend.title = element_text(color = "grey40", 
##                 size = 36), panel.background = element_rect(color = "gray85", 
##                 fill = "gray98"), panel.border = element_blank(), 
##             panel.grid.major.x = element_blank(), panel.grid.major.y = element_line(color = "gray90", 
##                 linewidth = 0.1), panel.grid.minor.x = element_blank(), 
##             panel.grid.minor.y = element_blank(), panel.spacing = unit(0.3, 
##                 "lines"), plot.background = element_rect(fill = "white"), 
##             plot.margin = grid::unit(c(2, 4, 2, 0), "mm"), plot.title = element_blank(), 
##             strip.background = element_rect(fill = "white"), 
##             strip.text.x = element_text(color = "grey25", lineheight = 2, 
##                 size = 34), strip.text.y.left = element_text(angle = 0, 
##                 color = "grey25", lineheight = 0.15, size = 34), 
##             text = element_text(family = family))
##     }
##     else if (type == "overlap") {
##         violinPlot <- ggplot(data = results) + aes(x = levelName, 
##             y = value, color = scenario) + geom_violin(alpha = 0.1, 
##             position = "identity", linewidth = 0.2) + ggh4x::facet_grid2(independent = "x", 
##             levelName ~ location, labeller = label_wrap_gen(width = 15), 
##             scales = "free", switch = "y") + labs(y = yaxisLab) + 
##             scale_color_manual(name = "scenario", values = levels(results$cols), 
##                 labels = levels(results$scenario)) + scale_y_continuous(limits = c(0, 
##             NA), position = "right") + guides(color = guide_legend(override.aes = list(linewidth = 2))) + 
##             theme(axis.text.x = element_blank(), axis.text.y = element_text(color = "grey40", 
##                 size = 24), axis.ticks.x = element_blank(), axis.ticks.y = element_line(color = "grey90", 
##                 linewidth = 0.2), axis.title.x = element_blank(), 
##                 axis.title.y = element_text(color = "grey40", 
##                   size = 32), legend.box.margin = margin(-4, 
##                   -4, -4, -4), legend.key.size = unit(0.4, "line"), 
##                 legend.justification = "center", legend.margin = margin(c(2, 
##                   0, 4, 0)), legend.position = "bottom", legend.spacing.x = unit(1.4, 
##                   "mm"), legend.text = element_text(color = "grey25", 
##                   size = 32), legend.title = element_text(color = "grey25", 
##                   size = 36), panel.background = element_rect(color = "gray85", 
##                   fill = "gray98"), panel.border = element_blank(), 
##                 panel.grid.major.x = element_blank(), panel.grid.major.y = element_line(color = "gray90", 
##                   linewidth = 0.1), panel.grid.minor.x = element_blank(), 
##                 panel.grid.minor.y = element_blank(), panel.spacing = unit(0.3, 
##                   "lines"), plot.background = element_rect(fill = "white"), 
##                 plot.margin = grid::unit(c(2, 4, 2, 0), "mm"), 
##                 plot.title = element_blank(), strip.background = element_rect(fill = "white"), 
##                 strip.text.x = element_text(color = "grey25", 
##                   lineheight = 2, size = 34), strip.text.y.left = element_text(angle = 0, 
##                   color = "grey25", lineheight = 0.15, size = 34), 
##                 text = element_text(family = family))
##     }
##     return(violinPlot)
## }
## <bytecode: 0x00000268c8b13038>
## <environment: namespace:AHgen>


2.1.1. Violin plots with vis_plotViolin()

The function vis_plotViolin() generates violin plots showing the distribution of results values, comparing new scenarios against a benchmark.

It has five input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • metricName - the metric for which results will be displayed, e.g. “EC” or “SBC_norm”
  • type - whether the benchmark results and scenario results are displayed side-by-side (type = "half") or as overlapping wholes (type = "overlap"); by default this is set to type = "half")
  • levels - the levels of the Abstraction Hierarchy for which results will be displayed; by default this is set to levels = NULL such that within the function the selection of levels displayed is automated depending on the metric being visualised
  • family - the font family to visualise; by default this is set to family = "Harding"
# Read in comparison of scenarios
allScenarios_compared =
  read_rds(
    "inputs/comparison_USAH_3.0_fiveCities-baseline_fiveCities-floodRiver-100-200_20230720-174337.RDS")

# Reformat scenario column to rename into a more visually friendly format
# assign the new scenario names to ordered levels
# and add the custom colours
results = 
  allScenarios_compared$results %>%
  mutate(scenario = recode(scenario,
                           'floodRiver-100' = '1 in 100-year flood',
                           'floodRiver-200' = '1 in 200-year flood')) %>%
  mutate(scenario = factor(scenario, 
                           levels = c("baseline", 
                                      "1 in 100-year flood", 
                                      "1 in 200-year flood"))) %>%
  full_join(colsFloodRiver_df)
## Joining with `by = join_by(scenario)`
# Half violin plot for Eigenvector Centrality results
violinHalf_ECvals = 
  vis_plotViolin(
    results = results, 
    metricName = "EC", 
    family = "Harding")
violinHalf_ECvals
# Overlap violin plot for Stable Betweenness Centrality results
violinOverlap_SBCvals = 
  vis_plotViolin(
    results = results, 
    metricName = "SBC_norm", 
    type = "overlap", 
    family = "Harding")
violinOverlap_SBCvals

2.1.2. Scatter plots with vis_plotScatter()

The function vis_plotScatter() generates scatter plots showing the distribution of either results values, change from benchmark values, or percentage change from benchmark values.

It has nine input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • metricName - the metric for which results will be displayed, e.g. “EC” or “SBC_norm”
  • AH_benchmark - the benchmark scenario to compare other scenarios to; by default this is set to AH_benchmark = "baseline"
  • type - the type of results to be displayed; options are type = "values", type = "valuesChange", or type = "percentChange"
  • levels - the levels of the Abstraction Hierarchy for which results will be displayed; by default this is set to levels = NULL such that within the function the selection of levels displayed is automated depending on the metric being visualised
  • locations - ; by default this is set to locations = NULL
  • omit.zeros - ; by default this is set to omit.zeros = TRUE
  • omit.inf - ; by default this is set to omit.inf = TRUE
  • family - the font family to visualise; by default this is set to family = "Harding"
# Read in comparison of scenarios
allScenarios_compared =
  read_rds(
    "inputs/comparison_USAH_3.0_fiveCities-baseline_fiveCities-floodRiver-100-200_20230720-174337.RDS")

# Reformat scenario column to rename into a more visually friendly format
# assign the new scenario names to ordered levels
# and add the custom colours
results = 
  allScenarios_compared$results %>%
  mutate(scenario = recode(scenario,
                           'floodRiver-100' = '1 in 100-year flood',
                           'floodRiver-200' = '1 in 200-year flood')) %>%
  mutate(scenario = factor(scenario, 
                           levels = c("baseline", 
                                      "1 in 100-year flood", 
                                      "1 in 200-year flood"))) %>%
  full_join(colsFloodRiver_df)
## Joining with `by = join_by(scenario)`
# Scatter plot of Eigenvector Centrality values
scatter_all_ECvals = 
  vis_plotScatter(
    results = results, 
    metricName = "EC", 
    type = "values")
scatter_all_ECvals
# Scatter plot of Eigenvector Centrality values for specific levels and locations
scatter_variation_ECvals = 
  vis_plotScatter(
    results = results,
    levels = c("Outcomes", "Tasks"), 
    locations = c("Edinburgh", "Glasgow"),
    metricName = "EC", 
    type = "values")
scatter_variation_ECvals
# Scatter plot of Eigenvector Centrality values change
scatter_variation_ECvals = 
  vis_plotScatter(
    results = results, 
    metricName = "EC", 
    type = "valuesChange")
scatter_variation_ECvalsChange
# Scatter plot of Stable Betweenness Centrality percent change
scatter_all_SBCpctChange = 
  vis_plotScatter(
    results = results, 
    metricName = "SBC_norm", 
    type = "percentChange")
scatter_all_SBCpctChange


2.1.3. Rank change plots with vis_plotRank()

The function vis_plotRank() generates line charts showing changing rank by level results across scenarios.

It has seven input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • metricName - the metric for which results will be displayed, e.g. “EC” or “SBC_norm”
  • AH_benchmark - the benchmark scenario to compare other scenarios to; by default this is set to AH_benchmark = "baseline"
  • levels - the levels of the Abstraction Hierarchy for which results will be displayed; by default this is set to levels = NULL such that within the function the selection of levels displayed is automated depending on the metric being visualised
  • change.only - a specification to use colours only for vertices with a changed rank; by default this is set to change.only = FALSE
  • confidence.lines - a specification to use line types (e.g. dotted and dashed) to signify confidence ratings of rank changes; by default this is set to confidence.lines = FALSE
  • family - the font family to visualise; by default this is set to family = "Harding"
# Read in comparison of scenarios
allScenarios_compared =
  read_rds(
    "inputs/comparison_USAH_3.0_fiveCities-baseline_fiveCities-floodRiver-100-200_20230720-174337.RDS")

# Reformat scenario column to rename into a more visually friendly format
# assign the new scenario names to ordered levels
# and add the custom colours
results = 
  allScenarios_compared$results %>%
  mutate(scenario = recode(scenario,
                           'floodRiver-100' = '1 in 100-year flood',
                           'floodRiver-200' = '1 in 200-year flood')) %>%
  mutate(scenario = factor(scenario, 
                           levels = c("baseline", 
                                      "1 in 100-year flood", 
                                      "1 in 200-year flood"))) %>%
  full_join(cols100RC_df)
## Joining with `by = join_by(level, levelName_full, levelName, Node)`
# Line rank plot of Outcomes and rank changes by Eigenvector Centrality
rank_outcomes_ECvals = 
  vis_plotRank(
    results = results, 
    metricName = "EC", 
    levels = "Outcomes", 
    change.only = TRUE)
rank_outcomes_ECvals
# Line rank plot of top Resources and rank changes by Stable Betweenness Centrality
rank_resources_SBCvals = 
  vis_plotRank(
    results = results, 
    metricName = "SBC_norm", 
    levels = "Resources", 
    change.only = TRUE)
rank_resources_SBCvals

Note that for Stable Betweenness Centrality ranks - unlike Eigenvector Centrality ranks - multiple vertices can be positioned at the same rank. This is due to having the same number of “shortest paths”. For this reason SBC rank is also more prone to low confidence ratings, however these confidence ratings are still displayed for completeness.

2.1.4. Summarising confidence ratings for rank changes with vis_plotConfidence()

The function vis_plotConfidence() generates bar charts summarising confidence ratings for rank by level results.

It has input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • metricName - the metric for which results will be displayed, e.g. “EC” or “SBC_norm”
  • type - the type of results to be displayed; options are type = "scenarioLevel", type = "scenario", type = "level", or type = "overall"
  • family - the font family to visualise; by default this is set to family = "Harding"

Note that for Eigenvector Centrality, type = "scenario" and type = "overall" capture results only for the Purposes, Outcomes, and Tasks levels of the Abstraction Hierarchy. Likewise for Stable Betweenness Centrality, this captures results only for the Tasks, Processes, and Resources levels of the Abstraction Hierarchy.

# Confidence ratings for rank by level by Eigenvector Centrality
# broken down by scenario and level
confidence_EC_scenarioLevel = 
  vis_plotConfidence(
    results = allScenarios_compared, 
    metricName = "EC", 
    type = "scenarioLevel")
confidence_EC_scenarioLevel
# Confidence ratings for rank by level by Stable Betweenness Centrality
# broken down by scenario and level
confidence_SBC_scenarioLevel = 
  vis_plotConfidence(
    results = allScenarios_compared, 
    metricName = "SBC_norm", 
    type = "scenarioLevel")
confidence_SBC_scenarioLevel
# Confidence ratings for rank by level by Stable Betweenness Centrality
# broken down by scenario
confidence_EC_scenario = 
  vis_plotConfidence(
    results = allScenarios_compared, 
    metricName = "EC", 
    type = "scenario")
confidence_EC_scenario
# Confidence ratings for rank by level by Stable Betweenness Centrality
# broken down by level
confidence_EC_level = 
  vis_plotConfidence(
    results = allScenarios_compared, 
    metricName = "EC", 
    type = "level")
confidence_EC_level
# Confidence ratings for rank by level by Stable Betweenness Centrality
# overall
confidence_EC_overall = 
  vis_plotConfidence(
    results = allScenarios_compared, 
    metricName = "EC", 
    type = "overall")
confidence_EC_overall


2.2. Tables

It is sometimes useful to summarise results in a table format which can be exported as an Excel sheet, for reports and academic papers. AHgen has several preset functions for this.

2.2.1. Summary tables for number of vertices and edges

The function table_vertices() creates a summary table of Abstraction Hierarchy vertices; likewise the function table_edges() creates a summary table of Abstraction Hierarchy edges.

They have four input arguments:

  • vSummary or eSummary, respectively - the summary of vertices or edges, in standard AHgen output
  • singleScenario - whether the vSummary or eSummary include a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vSummary or eSummary include multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vSummary or eSummary include multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`

The table provides both the number of vertices (or edges) in each level (or layer), as well as the percentage as compared to the total number of vertices or edges in that Abstraction Hierarchy as a whole.

# Read in comparison of scenarios
allScenarios_compared =
  read_rds(
    "inputs/comparison_USAH_3.0_fiveCities-baseline_fiveCities-floodRiver-100-200_20230720-174337.RDS")

# Create summary table of vertices
# comparing location-scenario combinations
tbl_vertices_multi = 
  table_vertices(
    vSummary = allScenarios_compared$vertices, 
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)

tbl_vertices_multi
## # A tibble: 30 × 5
##    levelName location  baseline     `floodRiver-100` `floodRiver-200`
##    <chr>     <chr>     <chr>        <chr>            <chr>           
##  1 Purposes  Bristol   8 (1.73%)    8 (1.73%)        <NA>            
##  2 Outcomes  Bristol   14 (3.03%)   14 (3.03%)       <NA>            
##  3 Tasks     Bristol   37 (8.01%)   37 (8.01%)       <NA>            
##  4 Processes Bristol   168 (36.36%) 168 (36.36%)     <NA>            
##  5 Resources Bristol   235 (50.87%) 235 (50.87%)     <NA>            
##  6 -         Bristol   462 (100%)   462 (100%)       <NA>            
##  7 Purposes  Edinburgh 8 (1.71%)    <NA>             8 (1.71%)       
##  8 Outcomes  Edinburgh 14 (2.99%)   <NA>             14 (2.99%)      
##  9 Tasks     Edinburgh 37 (7.89%)   <NA>             37 (7.89%)      
## 10 Processes Edinburgh 169 (36.03%) <NA>             169 (36.03%)    
## # ℹ 20 more rows
# Create summary table of edges
# comparing location-scenario combinations
tbl_edges_multi = 
  table_edges(
    eSummary = allScenarios_compared$edges, 
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)

tbl_edges_multi
## # A tibble: 25 × 5
##    layer      location  baseline      `floodRiver-100` `floodRiver-200`
##    <chr>      <chr>     <chr>         <chr>            <chr>           
##  1 l1FP_l2VPM Bristol   48 (1.14%)    48 (1.14%)       <NA>            
##  2 l2VPM_l3GF Bristol   147 (3.49%)   147 (3.49%)      <NA>            
##  3 l3GF_l4ORP Bristol   709 (16.85%)  709 (16.85%)     <NA>            
##  4 l4ORP_l5PO Bristol   3304 (78.52%) 3304 (78.52%)    <NA>            
##  5 Total      Bristol   4208 (100%)   4208 (100%)      <NA>            
##  6 l1FP_l2VPM Edinburgh 48 (1.12%)    <NA>             48 (1.12%)      
##  7 l2VPM_l3GF Edinburgh 147 (3.43%)   <NA>             147 (3.43%)     
##  8 l3GF_l4ORP Edinburgh 713 (16.65%)  <NA>             713 (16.65%)    
##  9 l4ORP_l5PO Edinburgh 3375 (78.8%)  <NA>             3375 (78.8%)    
## 10 Total      Edinburgh 4283 (100%)   <NA>             4283 (100%)     
## # ℹ 15 more rows


2.2.2. Summary table for excluded vertices

It has five input arguments:

  • vExcluded_benchmark - the excluded vertices from the benchmark scenario to be compared against, in standard AHgen output format
  • vExcluded_input - the excluded vertices from the new scenarios to compare, in standard AHgen output format
  • singleScenario - whether the vExcluded includes a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vExcluded includes multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vExcluded includes multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`
tbl_vExcluded = 
  table_vExcluded(
    vExcluded_benchmark = "NA", 
    vExcluded_input = allScenarios_compared$vExcluded, 
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)

tbl_vExcluded
## # A tibble: 116 × 7
## # Rowwise: 
##    location Level         Node        baseline `floodRiver-100` `floodRiver-200`
##    <chr>    <chr>         <chr>       <chr>    <chr>            <chr>           
##  1 Bristol  4 - Processes Dispose wa… X        X                <NA>            
##  2 Bristol  4 - Processes Manufactur… X        X                <NA>            
##  3 Bristol  4 - Processes <NA>        2        2                <NA>            
##  4 Bristol  5 - Resources Absorption… X        X                <NA>            
##  5 Bristol  5 - Resources Air bases   X        X                <NA>            
##  6 Bristol  5 - Resources Airports (… X        X                <NA>            
##  7 Bristol  5 - Resources Airports (… X        X                <NA>            
##  8 Bristol  5 - Resources Aquaculture X        X                <NA>            
##  9 Bristol  5 - Resources Armed forc… X        X                <NA>            
## 10 Bristol  5 - Resources Conference… X        X                <NA>            
## # ℹ 106 more rows
## # ℹ 1 more variable: `Number of Scenarios where Excluded` <int>

2.2.3. Summary table for Degree results

The functions table_degrees() generates a table of degree network analysis results for Abstraction Hierarchies.

It has five input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • levels - the levels of the Abstraction Hierarchy for which results will be displayed; by default this is set to levels = "all"
  • singleScenario - whether the vExcluded includes a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vExcluded includes multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vExcluded includes multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`
# Table of degree results for all Abstraction Hierarchy levels
# comparing across multiple locations and scenarios
tbl_degree_all = 
  table_rankDegree(
    results = allScenarios_compared$results, 
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)

tbl_degree_all
## # A tibble: 479 × 32
##    Level        Node               Bristol baseline - U…¹ Bristol baseline - D…²
##    <chr>        <chr>                               <dbl>                  <dbl>
##  1 1 - Purposes Cultural heritage…                      0                      4
##  2 1 - Purposes Economic opportun…                      0                      4
##  3 1 - Purposes Globalised connec…                      0                      6
##  4 1 - Purposes Knowledge transfe…                      0                      6
##  5 1 - Purposes Physical settleme…                      0                      7
##  6 1 - Purposes Pooling of resour…                      0                      6
##  7 1 - Purposes Safety and securi…                      0                      8
##  8 1 - Purposes Social opportunit…                      0                      7
##  9 2 - Outcomes Collective identi…                      6                     11
## 10 2 - Outcomes Comprehensive sec…                      1                      6
## # ℹ 469 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Up Degree`,
## #   ²​`Bristol baseline - Down Degree`
## # ℹ 28 more variables: `Bristol baseline - Total Degree` <dbl>,
## #   `Bristol floodRiver-100 - Up Degree` <dbl>,
## #   `Bristol floodRiver-100 - Down Degree` <dbl>,
## #   `Bristol floodRiver-100 - Total Degree` <dbl>, …
# Table of degree results for Resources level
# comparing across multiple locations and scenarios
tbl_degrees_resources = 
  table_rankDegree(
    results = allScenarios_compared$results, 
    levels = "Resources", 
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)

tbl_degrees_resources
## # A tibble: 250 × 42
##    Level         Node              Bristol baseline - P…¹ Bristol baseline - O…²
##    <chr>         <chr>                              <dbl>                  <dbl>
##  1 5 - Resources ATMs                                   8                     12
##  2 5 - Resources Accountancy firms                      8                     14
##  3 5 - Resources Advertising                            8                     10
##  4 5 - Resources Agriculture                            8                     14
##  5 5 - Resources Airplanes and he…                      8                     14
##  6 5 - Resources Ambulance statio…                      8                     14
##  7 5 - Resources Animal care                            8                     14
##  8 5 - Resources Animal shelters                        8                     10
##  9 5 - Resources Apparel retail                         8                     14
## 10 5 - Resources Apparel services                       8                     10
## # ℹ 240 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Purposes`,
## #   ²​`Bristol baseline - Outcomes`
## # ℹ 38 more variables: `Bristol baseline - Tasks` <dbl>,
## #   `Bristol baseline - Processes` <dbl>,
## #   `Bristol floodRiver-100 - Purposes` <dbl>,
## #   `Bristol floodRiver-100 - Outcomes` <dbl>, …


2.2.4. Summary table for Eigenvector Centrality results

The functions table_rankEC() generates a table of Eigenvector Centrality network analysis results for Abstraction Hierarchies.

It has four input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • singleScenario - whether the vExcluded includes a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vExcluded includes multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vExcluded includes multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`
tbl_EC = 
  table_rankEC(
    results = allScenarios_compared$results,
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)


2.2.5. Summary table for Stable Betweenness Centrality results

The functions table_rankSBC() generates a table of Stable Betweenness Centrality network analysis results for Abstraction Hierarchies.

It has four input arguments:

  • results - the results to be displayed, in standard AHgen output format
  • singleScenario - whether the vExcluded includes a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vExcluded includes multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vExcluded includes multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`
tbl_SBC = 
  table_rankSBC(
    results = allScenarios_compared$results,
    singleScenario = FALSE, 
    compareLocations = TRUE, 
    compareScenarios = TRUE)
## Warning: Values from `value_table` are not uniquely identified; output will contain
## list-cols.
## • Use `values_fn = list` to suppress this warning.
## • Use `values_fn = {summary_fun}` to summarise duplicates.
## • Use the following dplyr code to identify duplicates.
##   {data} %>%
##   dplyr::group_by(location, Level, rank_byLevel, scenario) %>%
##   dplyr::summarise(n = dplyr::n(), .groups = "drop") %>%
##   dplyr::filter(n > 1L)
tbl_SBC
## # A tibble: 540 × 6
##    location Level     Ranked Within Level by Stable …¹ baseline `floodRiver-100`
##    <chr>    <chr>                                <dbl> <chr>    <chr>           
##  1 Bristol  3 - Tasks                                1 Public … Public health (…
##  2 Bristol  3 - Tasks                                2 Goods a… Goods and servi…
##  3 Bristol  3 - Tasks                                3 Emergen… Emergency servi…
##  4 Bristol  3 - Tasks                                4 Governa… Governance (200…
##  5 Bristol  3 - Tasks                                5 Physica… Physical securi…
##  6 Bristol  3 - Tasks                                6 Employm… Employment prov…
##  7 Bristol  3 - Tasks                                7 Communi… Communication s…
##  8 Bristol  3 - Tasks                                8 Distrib… Distribution of…
##  9 Bristol  3 - Tasks                                9 Hydrome… Hydrometeorolog…
## 10 Bristol  3 - Tasks                               10 Technol… Technological h…
## # ℹ 530 more rows
## # ℹ abbreviated name: ¹​`Ranked Within Level by Stable Betweenness Centrality`
## # ℹ 1 more variable: `floodRiver-200` <chr>


2.2.6. tables_AHgen()

For a quick application of AHgen’s table_*() functions, you can use tables_AHgen().

It has eight input arguments:

  • vSummary - the summary of vertices, in standard AHgen output
  • eSummary - the summary of edges, in standard AHgen output
  • vExcluded_benchmark - the excluded vertices from the benchmark scenario to be compared against, in standard AHgen output format
  • vExcluded_input - the excluded vertices from the new scenarios to compare, in standard AHgen output format
  • results - the results to be displayed, in standard AHgen output format
  • singleScenario - whether the vSummary or eSummary include a single scenario or multiple scenarios; by default this is set to singleScenario = TRUE
  • compareLocations - whether the vSummary or eSummary include multiple locations to be compared; by default this is set to compareLocations = FALSE
  • compareScenarios - whether the vSummary or eSummary include multiple scenarios to be compared; by default this is set to *compareScenarios = FALSE`
tables_all = 
    tables_AHgen(
      vSummary = allScenarios_compared$vertices,
      eSummary = allScenarios_compared$edges,
      vExcluded_benchmark = "NA", 
      vExcluded_input = allScenarios_compared$vExcluded, 
      results = allScenarios_compared$results,
      singleScenario = FALSE, 
      compareLocations = TRUE, 
      compareScenarios = TRUE)
## Warning: Values from `value_table` are not uniquely identified; output will contain
## list-cols.
## • Use `values_fn = list` to suppress this warning.
## • Use `values_fn = {summary_fun}` to summarise duplicates.
## • Use the following dplyr code to identify duplicates.
##   {data} %>%
##   dplyr::group_by(location, Level, rank_byLevel, scenario) %>%
##   dplyr::summarise(n = dplyr::n(), .groups = "drop") %>%
##   dplyr::filter(n > 1L)
tables_all
## $vertices
## # A tibble: 30 × 5
##    levelName location  baseline     `floodRiver-100` `floodRiver-200`
##    <chr>     <chr>     <chr>        <chr>            <chr>           
##  1 Purposes  Bristol   8 (1.73%)    8 (1.73%)        <NA>            
##  2 Outcomes  Bristol   14 (3.03%)   14 (3.03%)       <NA>            
##  3 Tasks     Bristol   37 (8.01%)   37 (8.01%)       <NA>            
##  4 Processes Bristol   168 (36.36%) 168 (36.36%)     <NA>            
##  5 Resources Bristol   235 (50.87%) 235 (50.87%)     <NA>            
##  6 -         Bristol   462 (100%)   462 (100%)       <NA>            
##  7 Purposes  Edinburgh 8 (1.71%)    <NA>             8 (1.71%)       
##  8 Outcomes  Edinburgh 14 (2.99%)   <NA>             14 (2.99%)      
##  9 Tasks     Edinburgh 37 (7.89%)   <NA>             37 (7.89%)      
## 10 Processes Edinburgh 169 (36.03%) <NA>             169 (36.03%)    
## # ℹ 20 more rows
## 
## $edges
## # A tibble: 25 × 5
##    layer      location  baseline      `floodRiver-100` `floodRiver-200`
##    <chr>      <chr>     <chr>         <chr>            <chr>           
##  1 l1FP_l2VPM Bristol   48 (1.14%)    48 (1.14%)       <NA>            
##  2 l2VPM_l3GF Bristol   147 (3.49%)   147 (3.49%)      <NA>            
##  3 l3GF_l4ORP Bristol   709 (16.85%)  709 (16.85%)     <NA>            
##  4 l4ORP_l5PO Bristol   3304 (78.52%) 3304 (78.52%)    <NA>            
##  5 Total      Bristol   4208 (100%)   4208 (100%)      <NA>            
##  6 l1FP_l2VPM Edinburgh 48 (1.12%)    <NA>             48 (1.12%)      
##  7 l2VPM_l3GF Edinburgh 147 (3.43%)   <NA>             147 (3.43%)     
##  8 l3GF_l4ORP Edinburgh 713 (16.65%)  <NA>             713 (16.65%)    
##  9 l4ORP_l5PO Edinburgh 3375 (78.8%)  <NA>             3375 (78.8%)    
## 10 Total      Edinburgh 4283 (100%)   <NA>             4283 (100%)     
## # ℹ 15 more rows
## 
## $vExcluded
## # A tibble: 116 × 7
## # Rowwise: 
##    location Level         Node        baseline `floodRiver-100` `floodRiver-200`
##    <chr>    <chr>         <chr>       <chr>    <chr>            <chr>           
##  1 Bristol  4 - Processes Dispose wa… X        X                <NA>            
##  2 Bristol  4 - Processes Manufactur… X        X                <NA>            
##  3 Bristol  4 - Processes <NA>        2        2                <NA>            
##  4 Bristol  5 - Resources Absorption… X        X                <NA>            
##  5 Bristol  5 - Resources Air bases   X        X                <NA>            
##  6 Bristol  5 - Resources Airports (… X        X                <NA>            
##  7 Bristol  5 - Resources Airports (… X        X                <NA>            
##  8 Bristol  5 - Resources Aquaculture X        X                <NA>            
##  9 Bristol  5 - Resources Armed forc… X        X                <NA>            
## 10 Bristol  5 - Resources Conference… X        X                <NA>            
## # ℹ 106 more rows
## # ℹ 1 more variable: `Number of Scenarios where Excluded` <int>
## 
## $degree_all
## # A tibble: 479 × 32
##    Level        Node               Bristol baseline - U…¹ Bristol baseline - D…²
##    <chr>        <chr>                               <dbl>                  <dbl>
##  1 1 - Purposes Cultural heritage…                      0                      4
##  2 1 - Purposes Economic opportun…                      0                      4
##  3 1 - Purposes Globalised connec…                      0                      6
##  4 1 - Purposes Knowledge transfe…                      0                      6
##  5 1 - Purposes Physical settleme…                      0                      7
##  6 1 - Purposes Pooling of resour…                      0                      6
##  7 1 - Purposes Safety and securi…                      0                      8
##  8 1 - Purposes Social opportunit…                      0                      7
##  9 2 - Outcomes Collective identi…                      6                     11
## 10 2 - Outcomes Comprehensive sec…                      1                      6
## # ℹ 469 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Up Degree`,
## #   ²​`Bristol baseline - Down Degree`
## # ℹ 28 more variables: `Bristol baseline - Total Degree` <dbl>,
## #   `Bristol floodRiver-100 - Up Degree` <dbl>,
## #   `Bristol floodRiver-100 - Down Degree` <dbl>,
## #   `Bristol floodRiver-100 - Total Degree` <dbl>, …
## 
## $degrees_purposes
## # A tibble: 8 × 42
##   Level        Node                Bristol baseline - O…¹ Bristol baseline - T…²
##   <chr>        <chr>                                <dbl>                  <dbl>
## 1 1 - Purposes Cultural heritage …                      4                     31
## 2 1 - Purposes Economic opportuni…                      4                     24
## 3 1 - Purposes Globalised connect…                      6                     30
## 4 1 - Purposes Knowledge transfer…                      6                     28
## 5 1 - Purposes Physical settlement                      7                     35
## 6 1 - Purposes Pooling of resourc…                      6                     27
## 7 1 - Purposes Safety and security                      8                     33
## 8 1 - Purposes Social opportunity…                      7                     36
## # ℹ abbreviated names: ¹​`Bristol baseline - Outcomes`,
## #   ²​`Bristol baseline - Tasks`
## # ℹ 38 more variables: `Bristol baseline - Processes` <dbl>,
## #   `Bristol baseline - Resources` <dbl>,
## #   `Bristol floodRiver-100 - Outcomes` <dbl>,
## #   `Bristol floodRiver-100 - Tasks` <dbl>,
## #   `Bristol floodRiver-100 - Processes` <dbl>, …
## 
## $degrees_outcomes
## # A tibble: 14 × 42
##    Level        Node               Bristol baseline - P…¹ Bristol baseline - T…²
##    <chr>        <chr>                               <dbl>                  <dbl>
##  1 2 - Outcomes Collective identi…                      6                     11
##  2 2 - Outcomes Comprehensive sec…                      1                      6
##  3 2 - Outcomes Diverse livelihoo…                      4                      4
##  4 2 - Outcomes Effective leaders…                      4                     11
##  5 2 - Outcomes Effective provisi…                      2                     16
##  6 2 - Outcomes Effective safegua…                      2                      9
##  7 2 - Outcomes Empowered stakeho…                      4                      7
##  8 2 - Outcomes Environmental sus…                      3                     14
##  9 2 - Outcomes Integrated develo…                      4                     10
## 10 2 - Outcomes Minimal vulnerabi…                      3                     14
## 11 2 - Outcomes Reduced exposure …                      2                     11
## 12 2 - Outcomes Reliable communic…                      5                      7
## 13 2 - Outcomes Socio-economic eq…                      5                     18
## 14 2 - Outcomes Sustainable econo…                      3                      9
## # ℹ abbreviated names: ¹​`Bristol baseline - Purposes`,
## #   ²​`Bristol baseline - Tasks`
## # ℹ 38 more variables: `Bristol baseline - Processes` <dbl>,
## #   `Bristol baseline - Resources` <dbl>,
## #   `Bristol floodRiver-100 - Purposes` <dbl>,
## #   `Bristol floodRiver-100 - Tasks` <dbl>,
## #   `Bristol floodRiver-100 - Processes` <dbl>, …
## 
## $degrees_tasks
## # A tibble: 37 × 42
##    Level     Node                  Bristol baseline - P…¹ Bristol baseline - O…²
##    <chr>     <chr>                                  <dbl>                  <dbl>
##  1 3 - Tasks Animal welfare                             5                      2
##  2 3 - Tasks Biological hazard re…                      7                      5
##  3 3 - Tasks Ceremonies and servi…                      6                      1
##  4 3 - Tasks Clean air                                  5                      3
##  5 3 - Tasks Clean water                                5                      3
##  6 3 - Tasks Clothing provision                         3                      1
##  7 3 - Tasks Communication systems                      8                      7
##  8 3 - Tasks Community activities…                      8                      5
##  9 3 - Tasks Distribution of good…                      5                      2
## 10 3 - Tasks Emergency services                         6                      5
## # ℹ 27 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Purposes`,
## #   ²​`Bristol baseline - Outcomes`
## # ℹ 38 more variables: `Bristol baseline - Processes` <dbl>,
## #   `Bristol baseline - Resources` <dbl>,
## #   `Bristol floodRiver-100 - Purposes` <dbl>,
## #   `Bristol floodRiver-100 - Outcomes` <dbl>, …
## 
## $degrees_processes
## # A tibble: 170 × 42
##    Level         Node              Bristol baseline - P…¹ Bristol baseline - O…²
##    <chr>         <chr>                              <dbl>                  <dbl>
##  1 4 - Processes Accommodate pris…                      8                     14
##  2 4 - Processes Act as access po…                      8                      7
##  3 4 - Processes Act as access po…                      7                      5
##  4 4 - Processes Act as access po…                      5                      5
##  5 4 - Processes Act as access po…                      5                      2
##  6 4 - Processes Act as access po…                      8                     11
##  7 4 - Processes Act as access po…                      8                     10
##  8 4 - Processes Act as access po…                      8                      6
##  9 4 - Processes Act as access po…                      8                     10
## 10 4 - Processes Act as access po…                      8                     11
## # ℹ 160 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Purposes`,
## #   ²​`Bristol baseline - Outcomes`
## # ℹ 38 more variables: `Bristol baseline - Tasks` <dbl>,
## #   `Bristol baseline - Resources` <dbl>,
## #   `Bristol floodRiver-100 - Purposes` <dbl>,
## #   `Bristol floodRiver-100 - Outcomes` <dbl>, …
## 
## $degrees_resources
## # A tibble: 250 × 42
##    Level         Node              Bristol baseline - P…¹ Bristol baseline - O…²
##    <chr>         <chr>                              <dbl>                  <dbl>
##  1 5 - Resources ATMs                                   8                     12
##  2 5 - Resources Accountancy firms                      8                     14
##  3 5 - Resources Advertising                            8                     10
##  4 5 - Resources Agriculture                            8                     14
##  5 5 - Resources Airplanes and he…                      8                     14
##  6 5 - Resources Ambulance statio…                      8                     14
##  7 5 - Resources Animal care                            8                     14
##  8 5 - Resources Animal shelters                        8                     10
##  9 5 - Resources Apparel retail                         8                     14
## 10 5 - Resources Apparel services                       8                     10
## # ℹ 240 more rows
## # ℹ abbreviated names: ¹​`Bristol baseline - Purposes`,
## #   ²​`Bristol baseline - Outcomes`
## # ℹ 38 more variables: `Bristol baseline - Tasks` <dbl>,
## #   `Bristol baseline - Processes` <dbl>,
## #   `Bristol floodRiver-100 - Purposes` <dbl>,
## #   `Bristol floodRiver-100 - Outcomes` <dbl>, …
## 
## $EC
## # A tibble: 295 × 8
##    location Level levelName_full    `Level Name` Ranked Within Level …¹ baseline
##    <chr>    <dbl> <fct>             <fct>                         <int> <chr>   
##  1 Bristol      1 Functional purpo… Purposes                          1 Physica…
##  2 Bristol      1 Functional purpo… Purposes                          2 Social …
##  3 Bristol      1 Functional purpo… Purposes                          3 Safety …
##  4 Bristol      1 Functional purpo… Purposes                          4 Knowled…
##  5 Bristol      1 Functional purpo… Purposes                          5 Cultura…
##  6 Bristol      1 Functional purpo… Purposes                          6 Pooling…
##  7 Bristol      1 Functional purpo… Purposes                          7 Globali…
##  8 Bristol      1 Functional purpo… Purposes                          8 Economi…
##  9 Bristol      2 Values and prior… Outcomes                          1 Socio-e…
## 10 Bristol      2 Values and prior… Outcomes                          2 Minimal…
## # ℹ 285 more rows
## # ℹ abbreviated name: ¹​`Ranked Within Level by Eigenvector Centrality`
## # ℹ 2 more variables: `floodRiver-100` <chr>, `floodRiver-200` <chr>
## 
## $SBC
## # A tibble: 540 × 6
##    location Level     Ranked Within Level by Stable …¹ baseline `floodRiver-100`
##    <chr>    <chr>                                <dbl> <chr>    <chr>           
##  1 Bristol  3 - Tasks                                1 Public … Public health (…
##  2 Bristol  3 - Tasks                                2 Goods a… Goods and servi…
##  3 Bristol  3 - Tasks                                3 Emergen… Emergency servi…
##  4 Bristol  3 - Tasks                                4 Governa… Governance (200…
##  5 Bristol  3 - Tasks                                5 Physica… Physical securi…
##  6 Bristol  3 - Tasks                                6 Employm… Employment prov…
##  7 Bristol  3 - Tasks                                7 Communi… Communication s…
##  8 Bristol  3 - Tasks                                8 Distrib… Distribution of…
##  9 Bristol  3 - Tasks                                9 Hydrome… Hydrometeorolog…
## 10 Bristol  3 - Tasks                               10 Technol… Technological h…
## # ℹ 530 more rows
## # ℹ abbreviated name: ¹​`Ranked Within Level by Stable Betweenness Centrality`
## # ℹ 1 more variable: `floodRiver-200` <chr>

Each list element will be treated as an Excel sheet, if you can export it as below using OSMtidy’s exportExcel() function.

# Load OSMtidy to use the exportExcel function
p_load(OSMtidy)

# Export
exportExcel(
  inputList = tables_all, 
  filenameTimestamp(
    prefix = "tables_USAH_3.0_fiveCities-baseline_fiveCities-floodRiver-100-200",
    extension = ".xlsx"))

Last updated

This vignette is associated with AHgen v1.0.0, and was last updated by Melissa Bedinger on 2023-07-26.